<template>
  <li class="item">
    <div class="left">
      <h4>id：{{ id }}</h4>
      <p>姓名：{{ title }}</p>
      <p>创建时间：{{ time }}</p>
    </div>
    <div class="right">
      <input type="button" :value="btnTxt" @click="changeFn">
    </div>
  </li>
</template>

<script>
export default {
  props:["id", "title", "time", "btnTxt"],
  emits:["changeList"],
  methods:{
    changeFn(){
      // 点击按钮时，向父组件发送id
      this.$emit("changeList", this.id);
    }
  }
}
</script>

<style>
.item{
  padding: 6px;margin: 10px 0;
  background: #eee;
  display:flex;
  align-items: center;
  justify-content: space-between;
}
</style>